package CPD;

import java.awt.Component; 
import java.awt.Color; 
import javax.swing.JTable; 
import javax.swing.SwingConstants;
import javax.swing.table.DefaultTableCellRenderer; 

public class MiRender extends DefaultTableCellRenderer{

	public Component getTableCellRendererComponent(JTable table,
      Object value, boolean isSelected, boolean hasFocus, int row, int column) {
      
		super.getTableCellRendererComponent (table, value, false, hasFocus, row, column);
		if ((row % 2)==1) { 
 			this.setOpaque(true);
 			this.setBackground(new Color(204, 255, 255));
 			this.setForeground(Color.BLACK);
 		}
		if ((row % 2)==0) { 
	         this.setOpaque(true);
	         this.setBackground(new Color(204, 255, 204));
	         this.setForeground(Color.BLACK);
		}
		if (isSelected) {
	         this.setOpaque(true);
	         this.setBackground(new Color(255, 204, 204));
	         this.setForeground(new Color(204, 0, 0));
		}
		this.setHorizontalAlignment(SwingConstants.CENTER);
		return this;
   }
}

